package hypeerweb;

import java.util.*;

public class ConnectionsReplacer extends ConnectionsModifier {
	public ConnectionsReplacer() {}
	
	public void modifyConnection(Node target, NodeDelegate connection, Node modifyingNode, Node replacingNode) {
		if(connection != null) {
			connection.replace(target, replacingNode);
		}
	}
	
	public Node getModifyingNode(Node startingNode) {
		return null;
	}
	
	public ArrayList<NodeDelegate> getAllConnections(Node target, Node deletionNode) {
		return target.getConnections().getAllConnections();
	}
	
	public void setWebId(Node node, Node modifyingNode, Node replacingNode) {
		replacingNode.setWebId(node.getWebId());
		if(replacingNode instanceof NodeProxy) {
			((NodeProxy) replacingNode).changeWebId(node.getWebId());
		}
	}
	
	public void modifyConnections(Node target, Node modifyingNode, Node replacingNode) {
		replacingNode.setConnections(target.getConnections());
	}
	
	public void refreshConnections(Node modifyingNode) {}
	 
	public Node finalizeConnections(Node target, Node modifyingNode, Node replacingNode) {
		return null;
	}
}
